package cn.me.alphamq.common.entity.req;

import cn.me.alphamq.common.entity.BaseMsg;
import cn.me.alphamq.common.model.broker.CommitLogTopicModel;
import cn.me.alphamq.common.model.broker.ConsumeQueueOffsetModel;

import java.util.List;
import java.util.UUID;

/**
 * 服务实例的心跳请求
 *
 * @author f
 */
public class ServiceHeartBeatReq extends BaseMsg {

    /**
     * broker 的版本号，非 broker 的服务实例没有这个值
     */
    private long version;

    /**
     * broker 中所有 topic 的模型
     */
    private List<CommitLogTopicModel> commitLogTopicModelList;

    /**
     * broker 中所有消费偏移量的模型
     */
    private ConsumeQueueOffsetModel consumeQueueOffsetModel;

    public ServiceHeartBeatReq() {
    }

    public ServiceHeartBeatReq(long version, List<CommitLogTopicModel> commitLogTopicModelList,
                               ConsumeQueueOffsetModel consumeQueueOffsetModel) {
        super(UUID.randomUUID().toString());
        this.version = version;
        this.commitLogTopicModelList = commitLogTopicModelList;
        this.consumeQueueOffsetModel = consumeQueueOffsetModel;
    }

    public long getVersion() {
        return version;
    }

    public void setVersion(long version) {
        this.version = version;
    }

    public List<CommitLogTopicModel> getCommitLogTopicModelList() {
        return commitLogTopicModelList;
    }

    public void setCommitLogTopicModelList(List<CommitLogTopicModel> commitLogTopicModelList) {
        this.commitLogTopicModelList = commitLogTopicModelList;
    }

    public ConsumeQueueOffsetModel getConsumeQueueOffsetModel() {
        return consumeQueueOffsetModel;
    }

    public void setConsumeQueueOffsetModel(ConsumeQueueOffsetModel consumeQueueOffsetModel) {
        this.consumeQueueOffsetModel = consumeQueueOffsetModel;
    }
}
